<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!doctype html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta charset="utf-8">
<title>存管提现记录</title>
<link type="text/css" rel="stylesheet" href="static/bootstrap2/css/bootstrap.min.css" />
<link type="text/css" rel="stylesheet" href="static/jquery-easyui-1.4.4/themes/bootstrap/easyui.css" />
<link type="text/css" rel="stylesheet" href="static/jquery-easyui-1.4.4/themes/icon.css" />
<style type="text/css">
.form-horizontal .controls {
	
}
.table th {
	text-align: center;
}
.table td {
	text-align: center;
}
</style>
</head>
<body class="easyui-layout">
	<div data-options="region:'center',split:true" style="background-color: #eee; border: 0px;">
		<table id="tt" class="easyui-datagrid" style="width: 100%; height: 100%;" data-options="rownumbers:true,singleSelect:true,url:'query.htm?listId=SLAVE_WITHDRAW_ANALYSIS.findJzhWithdrawList&countId=SLAVE_WITHDRAW_ANALYSIS.findJzhWithdrawCount',method:'post',toolbar:toolbar,pagination:true,rownumbers:true,sortName:'date',sortOrder:'desc',fitColumns:true">
			<thead>
				<tr>
					<th field="ID">ID</th>
					<th field="用户手机号">用户手机号</th>
					<th field="姓名">姓名</th> 
					<th field="提现金额" align="right" data-options="formatter:cellAmount">提现金额</th>
					<th field="提现手续费" align="right" data-options="formatter:cellAmount">提现手续费</th>
					<th field="提现到账金额" align="right" data-options="formatter:cellAmount">提现到账金额</th>
					<th field="提现申请时间" data-options="formatter:cellApplyTime">提现申请时间</th>
					<th field="提现状态">提现状态</th>
					<th field="备注">备注</th>
				</tr>
			</thead>
		</table>
	</div>
	
	<div id="conditionDiv">
		<span> 提现申请时间：</span> <input class="easyui-datebox" id="beginTime"
			data-options="showSeconds:true" style="width: 110px; height: 30px;" />
		<span>－</span> <input class="easyui-datebox" id="endTime"
			data-options="showSeconds:true" style="width: 110px; height: 30px;" />
		<span> 用户手机号：</span><input id="mobile" style="width: 150px;" />
		<span> 提现状态：</span>
		<select id="status" style="margin-bottom: 0px; width: 130px;">
			<option value="">全部</option>
			<option value="1">处理中</option>
			<option value="2">提现成功</option>
			<option value="-1">提现失败</option>
		</select>
		<button class="btn" id="btnQuery">查询</button> 
		<button class="btn" id="btnExport">导出Excel</button>　　
		<span id="withdrawSumAmount" style="color:red;">提现总额：#.##元</span>　
		<span id="withdrawTransferedSumAmount" style="color:red;">提现到账总额：#.##元</span>
	</div>

	<script type="text/javascript" src="static/jquery-1.11.0.js"></script>
	<script type="text/javascript" src="static/bootstrap2/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="static/jquery-easyui-1.4.4/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="static/jquery-easyui-1.4.4/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="static/comm.js"></script>
	<script type="text/javascript">
		var toolbar = [];
		function cellApplyTime(val, row) {
			if (!val) {
				return "";
			}
			return new Date(val).toCNString();
		}

		function cellAmount(val, row) {
			return val.toFixed(2);
		}

		function sortableStyle(value, row, index) {
			return 'background-color:#CC9966;';
		}

		$(function() {
			$('#conditionDiv').appendTo($($(".datagrid-toolbar")[0]).find("tr"));
			
			$.post("query.htm",{
				t:new Date(),
				listId:"SLAVE_WITHDRAW_ANALYSIS.findJzhWithdrawSumAmount",
				mobile : $("#mobile").val().trim(),
				status : $("#status").val().trim(),
				beginTime : $('#beginTime').datebox('getValue'),
				endTime : $('#endTime').datebox('getValue')
			},function(data){
				console.log(data.rows[0]);
				$("#withdrawSumAmount").text("提现总额：" + data.rows[0].toFixed(2) + "元");
			},"json");
			
			$.post("query.htm",{
				t:new Date(),
				listId:"SLAVE_WITHDRAW_ANALYSIS.findJzhWithdrawTransferedSumAmount",
				mobile : $("#mobile").val().trim(),
				status : $("#status").val().trim(),
				beginTime : $('#beginTime').datebox('getValue'),
				endTime : $('#endTime').datebox('getValue')
			},function(data){
				console.log(data.rows[0]);
				$("#withdrawTransferedSumAmount").text("提现到账总额：" + data.rows[0].toFixed(2) + "元");
			},"json");
			
			
			$("#cashedType").change(function() {
				$("#tt").datagrid("load", QueryCondition.get());
			});

			$("#btnQuery").click(function() {
				$("#tt").datagrid("load", QueryCondition.get());
				$.post("query.htm",{
					t:new Date(),
					listId:"SLAVE_WITHDRAW_ANALYSIS.findJzhWithdrawSumAmount",
					mobile : $("#mobile").val().trim(),
					status : $("#status").val().trim(),
					beginTime : $('#beginTime').datebox('getValue'),
					endTime : $('#endTime').datebox('getValue')
				},function(data){
					console.log(data.rows[0]);
					$("#withdrawSumAmount").text("提现总额：" + data.rows[0].toFixed(2) + "元");
				},"json");
				
				$.post("query.htm",{
					t:new Date(),
					listId:"SLAVE_WITHDRAW_ANALYSIS.findJzhWithdrawTransferedSumAmount",
					mobile : $("#mobile").val().trim(),
					status : $("#status").val().trim(),
					beginTime : $('#beginTime').datebox('getValue'),
					endTime : $('#endTime').datebox('getValue')
				},function(data){
					console.log(data.rows[0]);
					$("#withdrawTransferedSumAmount").text("提现到账总额：" + data.rows[0].toFixed(2) + "元");
				},"json");
			});
			
			$("#btnExport").click(function(){
				var param = QueryCondition.get();
				
				var href="exportexcel.htm?listId=SLAVE_WITHDRAW_ANALYSIS.findJzhWithdrawList&rows=10000&excelname=存管提现记录";
				if(param.mobile){
					href+="&mobile="+param.mobile;
				}
				if(param.status){
					href+="&status="+param.status;
				}
				if(param.beginTime){
					href+="&beginTime="+param.beginTime;
				}
				if(param.endTime){
					href+="&endTime="+param.endTime;
				}
				window.open(href);
			});
		});

		var QueryCondition = {
			get : function() {
				var p = {
					mobile : $("#mobile").val().trim(),
					status : $("#status").val().trim(),
					beginTime : $('#beginTime').datebox('getValue'),
					endTime : $('#endTime').datebox('getValue')
				};
				return p;
			}
		};
	</script>
</body>
</html>